#ifndef WINDOW_H
#define WINDOW_H

#include <QtGui>
#include "glwidget.h"
#include "output.h"
#include "src/object.h"

class Window : public QMainWindow{
	Q_OBJECT

	public:
		Window();
		~Window();

    private slots:
        void newScene();
        void openObjects();
        void openSceneObjects();
        void saveSceneObjects();
        bool saveSceneObjectsAs();

        void editObjectDialog(QTreeWidgetItem *, int);
        void deleteObject();
        void duplicateObject();
        void analyzeObject();

        void changeSelection();

        void updateActions();
//        void updateAllTree();
//
//        void selectTreeItem(QTreeWidgetItem *, int);
        void addPrimitive(Object *, unsigned int);
        void newPolygonDialog();
        void newCuboidDialog();
        void newSphereDialog();
        void newCylinderDialog();
        void newConeDialog();

        void changeShowFace(bool);
        void changeShowEdge(bool);
        void changeShowVertex(bool);

        void translateOperation();
        void rotateOperation();
        void scaleOperation();
        void sweepOperation();
        void holeOperation();

        void selectAdjacentFace();
        void selectAdjacentEdge();
        void selectAdjacentVertex();


    private:
        int addTreeItem(Object *, QTreeWidgetItem *, bool);
        int updateObjects(std::vector<Object *>);
        void createWindow();

        QAction *saveObjectsAct;

        QAction *editObjectAct;
        QAction *deleteObjectAct;
        QAction *duplicateObjectAct;
        QAction *analysisObjectAct;

        QAction *newShowFaceAct;
        QAction *newShowEdgeAct;
        QAction *newShowVertexAct;

        QAction *selectAdjacentFaceAct;
        QAction *selectAdjacentEdgeAct;
        QAction *selectAdjacentVertexAct;

        QTreeWidget *tree;
        GLWidget *canvas;

        QList<QTreeWidgetItem *> previousSelected;
        QToolBar *geometricOperationToolBar;
        QAction *rotateAct;
        QAction *scaleAct;
        QAction *sweepAct;
        QAction *holeAct;

        Output output;

        bool inOperation;
};

#endif
